"""
📖 To learn: 组合数学，动态规划
"""

import sys
input = lambda: sys.stdin.readline().strip()
II = lambda: int(input())
MII = lambda: map(int, input().split())
LII = lambda: list(map(int, input().split()))
MOD = 10 ** 9 + 7
N = 495
n = II()
a = [x % N for x in LII()]
b = [x % N for x in LII()]
f1 = [[0] * N for _ in range(n + 1)] # f1[i][j]: 取了i个数，取模之后等于j的方案数
f2 = [[0] * N for _ in range(n + 1)] # f2[i][j]: 取了小于等于i个数，取模之后等于j的方案数
f1[0][0] = f2[0][0] = 1
for x in a:
    for i in range(n, 0, -1):
        for j in range(N):
            f1[i][(j + x) % N] += f1[i - 1][j]
            f1[i][(j + x) % N] %= MOD
for x in b:
    for i in range(n, 0, -1):
        for j in range(N):
            f2[i][(j + x) % N] += f2[i - 1][j]
            f2[i][(j + x) % N] %= MOD
for i in range(1, n + 1):
    for j in range(N):
        f2[i][j] += f2[i - 1][j]
        f2[i][j] %= MOD
res = [0] * N
for i in range(n + 1):
    for x in range(N):
        for y in range(N):
            res[(x + y) % N] += f1[i][x] * f2[i][y]
            res[(x + y) % N] %= MOD
print(*res)              